Skip to content

Add support for fulfillment payload - #3321

Open
t-bast wants to merge 2 commits into
masterfrom
fulfillment-payload-support
Open

Add support for fulfillment payload #3321
t-bast wants to merge 2 commits into
masterfrom
fulfillment-payload-support

Conversation

@t-bast

@t-bast t-bast commented Jun 19, 2026

Copy link
Copy Markdown
Member

This adds support for including a payload in update_fulfill_htlc that the recipient encrypts for the payer. This can be useful to transmit data atomically with the fulfillment of a payment. The main challenge is that intermediate nodes may drop or tamper with this fulfillment payload, which is why we include it in the HMACs of the attribution data, which lets senders detect which pair of nodes may be malicious.

See lightning/bolts#1344 for the detailed specification.

We don't currently include any fulfillment payload when we're the final node, but we correctly relay fulfillment payloads from downstream and correctly decrypt them when we're the sender. When we start including a fulfillment payload as the final node, we should also:

  • store the fulfillment payload inside the payment DB (on the sender side)
  • make sure that fulfillment payloads are correctly wrapped when using on-the-fly funding
  • make sure we correctly wrap fulfillment payloads in blinded routes where we added dummy hops

Note that we have verified cross-compatibility with LDK already.

@t-bast
t-bast force-pushed the fulfillment-payload-support branch from 6244b93 to b78ce34 Compare June 19, 2026 14:07
@t-bast
t-bast force-pushed the fulfillment-payload-support branch from b78ce34 to 16130a1 Compare June 24, 2026 08:08
@t-bast
t-bast force-pushed the fulfillment-payload-support branch from 16130a1 to 66c9499 Compare July 7, 2026 09:36
@t-bast
t-bast marked this pull request as ready for review July 27, 2026 17:36
@t-bast
t-bast force-pushed the fulfillment-payload-support branch 3 times, most recently from 1d9cd25 to 54a2567 Compare July 29, 2026 13:16
@t-bast
t-bast requested review from pm47 and sstone August 5, 2026 09:06
@joostjager

Copy link
Copy Markdown

Linking lightning/bolts#1349. We need to ensure we don't exceed the 64 kb message limit.

@t-bast
t-bast force-pushed the fulfillment-payload-support branch 2 times, most recently from 485b1f8 to 279ca7e Compare August 19, 2026 12:20
@t-bast

t-bast commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

Linking lightning/bolts#1349. We need to ensure we don't exceed the 64 kb message limit.

Thanks for the heads-up, this is implemented in the last commit!

t-bast added 2 commits August 19, 2026 16:19
This adds support for including a payload in `update_fulfill_htlc` that
the recipient encrypts for the payer. This can be useful to transmit
data atomically with the fulfillment of a payment. The main challenge
is that intermediate nodes may drop or tamper with this fulfillment
payload, which is why we include it in the HMACs of the attribution
data, which lets senders detect which pair of nodes may be malicious.

See lightning/bolts#1344
We limit error packets and fulfillment payloads to 32kB to leave room
for future TLVs. We silently truncate payloads that are larger, which
ensures that the messages we create are always compliant. We truncate
attribution data that doesn't have the expected length as well.
@t-bast
t-bast force-pushed the fulfillment-payload-support branch from 279ca7e to 5a93dde Compare August 19, 2026 14:23
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 94.84536% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.61%. Comparing base (d769db0) to head (5a93dde).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
.../scala/fr/acinq/eclair/payment/PaymentPacket.scala 94.44% 1 Missing ⚠️
...r/acinq/eclair/payment/relay/OnTheFlyFunding.scala 50.00% 1 Missing ⚠️
.../eclair/payment/relay/PostRestartHtlcCleaner.scala 85.71% 1 Missing ⚠️
...r/acinq/eclair/payment/send/PaymentLifecycle.scala 85.71% 1 Missing ⚠️
.../fr/acinq/eclair/wire/internal/CommandCodecs.scala 80.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3321      +/-   ##
==========================================
- Coverage   88.64%   88.61%   -0.04%     
==========================================
  Files         222      223       +1     
  Lines       21910    22096     +186     
  Branches      867      860       -7     
==========================================
+ Hits        19423    19580     +157     
- Misses       2487     2516      +29     
Files with missing lines Coverage Δ
...in/scala/fr/acinq/eclair/channel/ChannelData.scala 97.72% <100.00%> (+0.03%) ⬆️
...in/scala/fr/acinq/eclair/channel/fsm/Channel.scala 82.78% <100.00%> (-0.03%) ⬇️
...src/main/scala/fr/acinq/eclair/crypto/Sphinx.scala 100.00% <100.00%> (+0.67%) ⬆️
...c/main/scala/fr/acinq/eclair/db/pg/PgAuditDb.scala 88.74% <100.00%> (+0.02%) ⬆️
...cala/fr/acinq/eclair/db/sqlite/SqliteAuditDb.scala 88.30% <100.00%> (+0.02%) ⬆️
.../scala/fr/acinq/eclair/payment/PaymentEvents.scala 96.42% <ø> (ø)
...cinq/eclair/payment/receive/MultiPartHandler.scala 93.83% <100.00%> (ø)
...a/fr/acinq/eclair/payment/relay/ChannelRelay.scala 95.18% <100.00%> (ø)
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 93.72% <100.00%> (+0.50%) ⬆️
...clair/payment/send/MultiPartPaymentLifecycle.scala 93.42% <100.00%> (ø)
... and 9 more

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants